package com.myself.model.demo.netty.foundation;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import io.netty.util.CharsetUtil;

import java.util.List;
/**
 * @author Czx
 */
public class NettyDecoder extends MessageToMessageDecoder {

    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, Object o, List list) throws Exception {
        ByteBuf buffer = (ByteBuf) o;

        list.add(buffer.toString(CharsetUtil.UTF_8));
    }
}
